#类的学习
# 书籍-Dog类
class Dog:
    def __init__(self,name,age):
        #初始化类的属性
        self.name=name
        self.age=age

    def sit(self):
        print(self.name.title(),'is now sitting')
    def roll_over(self):
        print(self.name.title(),'rolled over ')

#创建实例
my_dog1=Dog('wille',6)
#访问属性
print('name is:',my_dog1.name)
print('age is:',my_dog1.age)

#调用方法
my_dog1.sit()
my_dog1.roll_over()
# name is: wille
# age is: 6
# Wille is now sitting
# Wille rolled over 


